In a semiconductor manufacturing apparatus that manufactures semiconductor devices using nanoimprint technology, there are cases where foreign objects on a semiconductor substrate clog the unevenness pattern of a template. The foreign objects clogging the template reduce the precision of the pattern that is formed. Therefore, cleaning of the template is performed every constant number of times the processing is performed. However, the foreign objects appear irregularly. In the case where the cleaning is performed every constant number of times the processing is performed, there are cases where a template that is still usable is unnecessarily cleaned. Unnecessary cleaning reduces the processing efficiency of the semiconductor manufacturing apparatus. Conversely, in the case where the foreign objects occur at a high frequency, there are cases where the use of the template is undesirably continued in a state in which the precision of the pattern is low.